#include "sem.hpp"
int main()
{
    ENABLE_FILTRATION(DEBUG);
    SemaphoreBuilder builder;
    SemPtr fsem = builder.SetVal(1).Build(CREATE_SEM, 1);

    pid_t id = fork();
    if (id == 0)
    {
        SemPtr csem = builder.Build(GET_SEM);
        while (true)
        {
            csem->P();
            printf("C");
            printf("C");
            fflush(stdout);
            sleep(1);
            csem->V();
        }
    }
    while (true)
    {
        fsem->P();
        printf("F");
        printf("F");
        fflush(stdout);
        sleep(1);
        fsem->V();
    }
    return 0;
}